package synchronicity.calendar;

import synchronicity.util.Range;
import synchronicity.util.RangeSet;

/**
 * An abstraction of a Calendar, that the synchronicity agents/hosts can use to
 * hide the underlying calendar from the application logic 
 */
public interface Calendar {
	public static class ModifyCalendarFailedException extends Exception {
	}
	
	/**
	 * Get the ranges of time that this host is unavailable.
	 * @param dateRange The range of time we're querying for (don't need to retrieve the whole calendar)
	 * @return A RangeSet representing the unavailable times
	 */
	public RangeSet getBusyTimes(Range dateRange);

	/**
	 * Add an event to this calendar
	 * @param dateRange The time of the event
	 * @param title The title of the event
	 * @throws ModifyCalendarFailedException
	 */
	public void addCalendarItem(Range dateRange, String title) throws ModifyCalendarFailedException;
}
